/*
 * @Author: muuzi@163.com muuzi@163.com
 * @Date: 2024-12-04 22:57:12
 * @LastEditors: muuzi@163.com muuzi@163.com
 * @LastEditTime: 2024-12-15 21:58:08
 * @FilePath: /mp-wechat/src/api/user.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
// api/user.ts

import request from '@/utils/request';
import type { UserForm } from './types';
enum Api {
    GET_USER_INFO = '/user/info',
    PUT_UPDATE = '/user/update',
  }
//获取用户信息
export const getUserInfo = () => {
    const token = uni.getStorageSync('App-Token');
    if (!token) return Promise.reject(new Error('用户未登录'));
    return request({
        url:Api.GET_USER_INFO,
        method:'GET'
    });
}

/**
 * 修改用户个人信息
 * @param data 用户信息
 */
export const updateUserProfile = (data: UserForm) => {
    return request({
      url: Api.PUT_UPDATE,
      method: "put",
      data: data,
    });
  };